﻿@model MovieHiresListViewModel
@{
    ViewBag.Title = "RentHistory";
    Layout = "~/Views/Shared/CustomerLayout.cshtml";
}

<h2>Historia wypożyczeń</h2>
@if (Model != null && Model.Hires.Count<Hires>() > 0)
{
    <table class="list" style="width: 100%;">
        <thead>
            <tr>
                <td>Film</td>
                <td>Nośnik</td>
                <td>Wydanie</td>
                <td>Wypożyczony</td>
                <td>Do zwrotu</td>
                <td>Zakończone</td>
            </tr>
        </thead>
        @foreach (Hires hire in Model.Hires)
        {
                <tr>
                    <td>@hire.Discs.Movies.MovieTitle</td>
                    <td>@hire.Discs.DiscTypes.DiscTypeName</td>
                    <td>@hire.Discs.DiscCount szt.</td>
                    <td>@hire.HireSignupDate.ToString("dd.MM.yyyyy")</td>
                    <td>@hire.HirePlanningReturningDate.Value.ToString("dd.MM.yyyyy")</td>
                    <td>@string.Format("{0}",hire.HireIsDiscReturned?"Tak":"Nie")</td>
                 </tr>
        }
    </table>
    
    <div class="pagesNavigation">
        @Html.PageLinks(Model.PagingInfo, x => Url.Action("RentHistory", new { page = x }))
    </div>
}
else
{
    <p>Nie wypożyczyłeś jeszcze żadnego filmu</p> 
}